package hhh.zjh.com.weightgauge;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;


public class Result extends AppCompatActivity {

    String sex;
    double weight;
    double height;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.result);
        height = getIntent().getFloatExtra("height",0.0f);
        sex = getIntent().getStringExtra("sex");
        if(sex.equals("M")){
            sex="男性";
        }else{
            sex="女性";
        }
        TextView output=(TextView)findViewById(R.id.output);
        System.out.println(sex);
        getWeight();
        output.setText("你是一位"+sex+"\n你的身高是"+height+"公分\n你的体重是"+weight+"公斤");
    }

  public void getWeight(){
        if(sex.equals("M")){
            weight=((height-80)*0.7);
        }else{
            weight=((height-70)*0.6);
        }
        return ;
    }

}
